package cate.game.activity.base.core;

import cate.game.fight.task.FightTask;
import cate.game.role.Role;
import cate.game.role.farm.IFarm;
import easy.java.dev.note.NoteField;

public abstract class RoleFarmActivitySingle extends RoleActivitySingle implements IFarm {
    @NoteField(value = "战斗")
    public boolean fighting;

    @Override
    public void initialize(Role role) {
        super.initialize(role);
        FightTask task = role.getGame().fight.task.getTask(role, getFightFuncId());
        fighting = task != null && !task.invalid();
    }

    @Override
    public void onEnter() {
        super.onEnter();
        FightTask task = role.getGame().fight.task.getTask(role, getFightFuncId());
        fighting = task != null && !task.invalid();
    }

    @Override
    public boolean isFighting() {
        return fighting;
    }

    @Override
    public void startFighting() {
        this.fighting = true;
    }

    @Override
    public void endFighting() {
        this.fighting = false;
    }
}
